print

The print command is a C-calculator mode command that writes the value of a valid mathematical expression to a file selected by set output. The default is stdout. If there is more than one variable, a coma separated list must be given in which case each expression value will printed on the same line and separated by a tab. As with other number output commands, the output format is the one selected by the set format command. The default is "The print command differs from show variables as follows:

print accepts any expression for indexing vector elements;

print requires a comma separated list;

print can be part of a function or procedure;

print can print strings provided they are in double quotes. This includes characters '\n', '\t', '\a', ...;

print does not append a newline.

print can print any mathemetical expression.

print is a C-calculator mode command.

A simpler way to print variables to stdout from the C-calculator mode is to use the feature that any variable or coma separated list of variables given on the command line will be displayed, separated by tabs and appended with a newline character. Thus the construction @ifhelp

     set output stdout
     cmode
         print x, y, "\n"
is equivalent to
     cmode
         x, y
typed in C-calculator mode (it becomes let x,y in fitting mode). The only difference between print and the automatic printing feature of C-calculator mode is that (1) set output only affects print command, and that (2) print does not automatically append a new line character.

print coma-separated-var-list

     cmode
         print x+2
         print String, x, y, z
         print "Warning \a\a\a", "x = ", x, "\n"

cmode, func, C, show table, show variable, math functions, quotes,
set format, set output